towards

 

Towards is a reporter that returns the angle that would be the heading of the caller if it was to face another specified agent. For example, if turtle 0 is at the center of the model, and turtle 1 is directly to the right of it, ask turtle 0 [ show towards turtle 1 ] would print 90. Towards reports the absolute angle between the coordinates of the two agents, and will change as the agents move around, but will not change if the headings of the agents change.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the towards primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the towards primitive:
 
 
Similar primitives:
face

Turn to face a specific agent.

Read more
right

Turn a certain amount of degrees to the right.

Read more
left

Turn a certain amount of degrees to the left.

Read more
 
Learn another primitive